-- Path of Building
--
-- Active Intelligence skill gems
-- Skill data (c) Grinding Gear Games
--
local skills, mod, flag, skill = ...

#skill Arc
#flags spell chaining
	statMap = {
		["arc_damage_+%_final_for_each_remaining_chain"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "PerStat", stat = "ChainRemaining" }),
		},
	},
#mods

#skill VaalArcChain
#flags spell chaining
	statMap = {
		["arc_damage_+%_final_for_each_remaining_chain"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "PerStat", stat = "ChainRemaining" }),
		},
	},
#mods

#skill ArcticBreath
#flags spell area projectile duration
#baseMod skill("radius", 12)
#mods

#skill CataclysmSigil
#flags spell area duration
	preDamageFunc = function(activeSkill, output)
		activeSkill.skillData.hitTimeOverride = activeSkill.skillData.repeatFrequency / (1 + activeSkill.skillModList:Sum("INC", activeSkill.skillCfg, "Speed", "BrandActivationFrequency") / 100)
	end,
	statMap = {
		["base_skill_show_average_damage_instead_of_dps"] = {
		},
		["base_sigil_repeat_frequency_ms"] = {
			skill("repeatFrequency", nil),
			div = 1000,
		},
	},
#baseMod skill("radius", 18)
#baseMod skill("radiusSecondary", 8)
#mods

#skill AssassinsMark
#flags spell curse area duration
	statMap = {
		["base_self_critical_strike_multiplier_-%"] = {
			mod("SelfCritMultiplier", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
			mult = -1,
		},
		["enemy_additional_critical_strike_chance_against_self"] = {
			mod("SelfCritChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
			div = 100,
		},
		["life_granted_when_killed"] = {
			mod("SelfLifeOnKill", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["mana_granted_when_killed"] = {
			mod("SelfManaOnKill", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 22)
#mods

#skill BallLightning
#flags spell projectile
#baseMod skill("radius", 22)
#mods

#skill DarkRitual
#flags spell duration area
	preDamageFunc = function(activeSkill, output)
		local curseCount = 0
		for _, skill in ipairs(activeSkill.actor.activeSkillList) do
			if skill.socketGroup == activeSkill.socketGroup and skill.skillModList:GetCondition("AppliedByBane") then
				curseCount = curseCount + 1
				if curseCount == output.EnemyCurseLimit then
					break
				end
			end
		end
		activeSkill.skillModList:NewMod("Multiplier:CurseApplied", "BASE", curseCount, "Base")
	end,
	statMap = {
		["dark_ritual_damage_+%_final_per_curse_applied"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "Multiplier", var = "CurseApplied" }),
		},
		["dark_ritual_skill_effect_duration_+%_per_curse_applied"] = {
			mod("Duration", "INC", nil, 0, 0, { type = "Multiplier", var = "CurseApplied" }),
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 21)
#mods

#skill SupportDarkRitual Bane
	statMap = {
		["apply_linked_curses_with_dark_ritual"] = {
			flag("Condition:AppliedByBane"),
		},
	},
#mods

#skill Blight
#flags spell duration area
#baseMod skill("debuff", true)
#baseMod skill("debuffSecondary", true)
#baseMod skill("radius", 26)
#mods

#skill VaalBlight
#flags spell duration area
	statMap = {
		["hinder_enemy_chaos_damage_taken_+%"] = {
			mod("ChaosDamageTaken", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff", effectName = "Hinder" }),
		},
	},
#baseMod skill("radius", 20)
#mods

#skill CorpseWarp
#flags spell area
	parts = {
		{
			name = "Self Explosion",
			spell = true,
			cast = false,
		},
		{
			name = "Corpse Explosion",
			spell = false,
			cast =  true,
		},
	},
	preDamageFunc = function(activeSkill, output)
		if activeSkill.skillPart == 1 then
			local skillData = activeSkill.skillData
			if activeSkill.skillFlags.totem then
				skillData.FireBonusMin = output.TotemLife * skillData.selfFireExplosionLifeMultiplier
				skillData.FireBonusMax = output.TotemLife * skillData.selfFireExplosionLifeMultiplier
			else
				skillData.FireBonusMin = output.Life * skillData.selfFireExplosionLifeMultiplier
				skillData.FireBonusMax = output.Life * skillData.selfFireExplosionLifeMultiplier
			end
		end
	end,
	statMap = {
		["spell_minimum_base_fire_damage"] = {
			skill("FireMin", nil, { type = "SkillPart", skillPart = 1 }),
		},
		["spell_maximum_base_fire_damage"] = {
			skill("FireMax", nil, { type = "SkillPart", skillPart = 1 }),
		},
	},
#baseMod skill("explodeCorpse", true, { type = "SkillPart", skillPart = 2 })
#mods

#skill BoneOffering
#flags spell duration
	statMap = {
		["monster_base_block_%"] = {
			mod("BlockChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["base_spell_block_%"] = {
			mod("SpellBlockChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("buffMinions", true)
#baseMod skill("buffNotPlayer", true)
#mods

#skill SigilRecall
#flags spell
#mods

#skill Clarity
#flags spell aura area
	statMap = {
		["base_mana_regeneration_rate_per_minute"] = {
			mod("ManaRegen", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
			div = 60,
		},
	},
#baseMod skill("radius", 40)
#mods

#skill VaalClarity
#flags spell aura area duration
	statMap = {
		["no_mana_cost"] = {
			mod("ManaCost", "MORE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
			value = -100,
		},
	},
#baseMod skill("radius", 40)
#mods

#skill ColdSnap
#flags spell area
#baseMod skill("showAverage", false)
#baseMod skill("radius", 16)
#baseMod skill("dotIsArea", true)
#mods

#skill VaalColdSnap
#flags spell area duration
#baseMod skill("dotIsArea", true)
#mods

#skill Conductivity
#flags spell curse area duration
	statMap = {
		["base_lightning_damage_resistance_%"] = {
			mod("LightningResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["chance_to_be_shocked_%"] = {
			mod("SelfShockChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["base_self_shock_duration_-%"] = {
			mod("SelfShockDuration", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
			div = -1,
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 22)
#mods

#skill Contagion
#flags spell area duration chaos
#baseMod skill("debuff", true)
#baseMod skill("radius", 20)
#mods

#skill ConversionTrap
#flags spell duration trap
#mods

#skill Convocation
#flags spell duration
	statMap = {
		["base_life_regeneration_rate_per_minute"] = {
			mod("LifeRegen", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
			div = 60,
		},
	},
#baseMod skill("buffMinions", true)
#baseMod skill("buffNotPlayer", true)
#mods

#skill DarkPact
#flags spell area
	parts = {
		{
			name = "Cast on Player",
		},
		{
			name = "Cast on Skeleton",
		},
	},
	preDamageFunc = function(activeSkill, output)
		local life
		if activeSkill.skillPart == 1 then
			if activeSkill.skillFlags.totem then
				life = output.TotemLife
			else
				life = output.Life
			end
		else
			life = activeSkill.skillData.skeletonLife or 0
		end
		local add = life * activeSkill.skillData.lifeDealtAsChaos / 100
		activeSkill.skillData.ChaosMin = activeSkill.skillData.ChaosMin + add
		activeSkill.skillData.ChaosMax = activeSkill.skillData.ChaosMax + add
	end,
	statMap = {
		["skeletal_chains_aoe_%_health_dealt_as_chaos_damage"] = {
			skill("lifeDealtAsChaos", nil),
		},
		["skeletal_chains_no_minions_radius_+"] = {
			skill("radiusExtra", nil, { type = "SkillPart", skillPart = 1 }),
		},
		["skeletal_chains_no_minions_damage_+%_final"] = {
			mod("Damage", "MORE", nil, 0, bit.bor(KeywordFlag.Hit, KeywordFlag.Ailment), { type = "SkillPart", skillPart = 1 }),
		},
	},
#baseMod skill("radius", 24)
#mods

#skill Despair
#flags spell curse area duration
	statMap = {
		["degen_effect_+%"] = {
			mod("DamageTakenOverTime", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["base_chaos_damage_resistance_%"] = {
			mod("ChaosResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["minimum_added_chaos_damage_taken"] = {
			mod("SelfChaosMin", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["maximum_added_chaos_damage_taken"] = {
			mod("SelfChaosMax", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 22)
#mods

#skill Discharge
#flags spell area
	statMap = {
		["discharge_triggered_damage_+%_final"] = {
			mod("Damage", "MORE", nil, ModFlag.Spell, 0, { type = "Condition", var = "SkillIsTriggered" }),
		},
	},
#baseMod skill("radius", 30)
#mods

#skill Discipline
#flags spell aura area
	statMap = {
		["energy_shield_recharge_rate_+%"] = {
			mod("EnergyShieldRecharge", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["base_maximum_energy_shield"] = {
			mod("EnergyShield", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#baseMod skill("radius", 40)
#mods

#skill VaalDiscipline
#flags spell aura area duration
	statMap = {
		["base_maximum_energy_shield"] = {
			mod("EnergyShield", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#baseMod skill("radius", 40)
#mods

#skill DivineTempest
#flags spell area
	parts = {
		{
			name = "Channelling",
			area = false,
		},
		{
			name = "Release at 10 Stages",
			area = true,
		},
		{
			name = "Release at 20 Stages",
			area = true,
		},
	},
	statMap = {
		["divine_tempest_damage_+%_final_while_channelling"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "SkillPart", skillPart = 1 }),
		},
		["divine_tempest_hit_damage_+%_final_per_stage"] = {
			mod("Damage", "MORE", nil, 0, KeywordFlag.Hit, { type = "Multiplier", var = "StageAfterFirst" }),
		},
		["divine_tempest_ailment_damage_+%_final_per_stage"] = {
			mod("Damage", "MORE", nil, 0, KeywordFlag.Ailment, { type = "Multiplier", var = "StageAfterFirst" }),
		},
	},
#baseMod skill("showAverage", true, { type = "SkillPart", skillPartList = { 2, 3 } })
#baseMod mod("Multiplier:StageAfterFirst", "BASE", 9, 0, 0, { type = "SkillPart", skillPart = 2 })
#baseMod mod("Multiplier:StageAfterFirst", "BASE", 19, 0, 0, { type = "SkillPart", skillPart = 3 })
#baseMod skill("radius", 38)
#mods

#skill ElementalWeakness
#flags spell curse area duration
	statMap = {
		["base_resist_all_elements_%"] = {
			mod("ElementalResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 22)
#mods

#skill Enfeeble
#flags spell curse area duration
	statMap = {
		["enfeeble_damage_+%_final"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }, { type = "Condition", var = "RareOrUnique", neg = true }),
		},
		["enfeeble_damage_+%_vs_rare_or_unique_final"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }, { type = "Condition", var = "RareOrUnique" }),
		},
		["critical_strike_chance_+%"] = {
			mod("CritChance", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["accuracy_rating_+%"] = {
			mod("Accuracy", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["base_critical_strike_multiplier_+"] = {
			mod("CritMultiplier", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 22)
#mods

#skill EssenceDrain
#flags spell projectile duration chaos
#baseMod skill("debuff", true)
#baseMod skill("showAverage", true)
#mods

#skill Fireball
#flags spell projectile
	parts = {
		{
			name = "Projectile",
			area = false,
		},
		{
			name = "Explosion",
			area = true,
		},
	},
#baseMod skill("radius", 9)
#mods

#skill VaalFireballSpiralNova
#flags spell projectile
	parts = {
		{
			name = "Projectile",
			area = false,
		},
		{
			name = "Explosion",
			area = true,
		},
	},
#mods

#skill Firestorm
#flags spell area duration
#baseMod skill("radius", 25)
#baseMod skill("radiusLabel", "Area in which fireballs fall:")
#baseMod skill("radiusSecondary", 10)
#baseMod skill("radiusSecondaryLabel", "Area of fireball explosion:")
#mods

#skill FlameDash
#flags spell area duration
#baseMod skill("dotIsArea", true)
#mods

#skill FlameWhip
#flags spell area
	statMap = {
		["flame_whip_damage_+%_final_vs_burning_enemies"] = {
			mod("Damage", "MORE", nil, ModFlag.Hit, 0, { type = "ActorCondition", actor = "enemy", var = "Burning" }),
		},
	},
#baseMod skill("radius", 30)
#mods

#skill Flameblast
#flags spell area
	parts = {
		{
			name = "1 Stage",
		},
		{
			name = "10 Stages",
		},
	},
	statMap = {
		["charged_blast_spell_damage_+%_final_per_stack"] = {
			mod("Damage", "MORE", nil, 0, KeywordFlag.Hit, { type = "Multiplier", var = "FlameblastStage" }),
		},
		["flameblast_ailment_damage_+%_final_per_stack"] = {
			mod("Damage", "MORE", nil, 0, KeywordFlag.Ailment, { type = "Multiplier", var = "FlameblastStage" }),
		},
		["flameblast_ignite_chance_+%_per_stage"] = {
			mod("EnemyIgniteChance", "BASE", nil, 0, 0, { type = "Multiplier", var = "FlameblastStage" }),
		},
		["base_skill_show_average_damage_instead_of_dps"] = {
		},
	},
#baseMod mod("Multiplier:FlameblastStage", "BASE", 9, 0, 0, { type = "SkillPart", skillPart = 2 })
#baseMod skill("dpsMultiplier", 0.1, { type = "SkillPart", skillPart = 2 })
#mods

#skill VaalFlameblast
#flags spell area
	statMap = {
		["charged_blast_spell_damage_+%_final_per_stack"] = {
			mod("Damage", "MORE", nil, 0, KeywordFlag.Hit, { type = "Multiplier", var = "FlameblastStage" }),
		},
	},
#baseMod mod("Multiplier:FlameblastStage", "BASE", 9)
#mods

#skill Flammability
#flags spell curse area duration
	statMap = {
		["base_fire_damage_resistance_%"] = {
			mod("FireResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["chance_to_be_ignited_%"] = {
			mod("SelfIgniteChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["base_self_ignite_duration_-%"] = {
			mod("SelfIgniteDuration", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
			mult = -1,
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 22)
#mods

#skill FleshOffering
#flags spell duration
	statMap = {
		["attack_speed_+%_granted_from_skill"] = {
			mod("Speed", "INC", nil, ModFlag.Attack, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["base_movement_velocity_+%"] = {
			mod("MovementSpeed", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["cast_speed_+%_granted_from_skill"] = {
			mod("Speed", "INC", nil, ModFlag.Cast, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("buffMinions", true)
#baseMod skill("buffNotPlayer", true)
#mods

#skill FreezingPulse
#flags spell projectile
	preDamageFunc = function(activeSkill, output)
		activeSkill.skillModList:NewMod("Damage", "MORE", -50, "Skill:FreezingPulse", { type = "DistanceRamp", ramp = {{0,0},{60*output.ProjectileSpeedMod,1}} })
		activeSkill.skillModList:NewMod("EnemyFreezeChance", "BASE", 25, "Skill:FreezingPulse", { type = "DistanceRamp", ramp = {{0,1},{15*output.ProjectileSpeedMod,0}} })
	end,
#mods

#skill FrostBomb
#flags spell area duration
	statMap = {
		["base_cold_damage_resistance_%"] = {
			mod("ColdResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff" }),
		},
		["energy_shield_recharge_rate_+%"] = {
			mod("EnergyShieldRecharge", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff" }),
		},
	},
#baseMod skill("debuffSecondary", true)
#mods

#skill FrostWall
#flags spell duration
#mods

#skill Frostbite
#flags spell curse area duration
	statMap = {
		["base_cold_damage_resistance_%"] = {
			mod("ColdResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["chance_to_be_frozen_%"] = {
			mod("SelfFreezeChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
		},
		["base_self_freeze_duration_-%"] = {
			mod("SelfFreezeDuration", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Curse" }),
			mult = -1,
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 22)
#mods

#skill IceDash
#flags spell area hit
#baseMod skill("showAverage", true)
#mods

#skill FrostBolt
#flags spell projectile
#mods

#skill GlacialCascade
#flags spell area
#baseMod skill("radius", 12)
#mods

#skill HeraldOfThunder
#flags cast duration
	statMap = {
		["herald_of_thunder_lightning_damage_+%"] = {
			mod("LightningDamage", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["spell_minimum_added_lightning_damage"] = {
			mod("LightningMin", "BASE", nil, 0, KeywordFlag.Spell, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["spell_maximum_added_lightning_damage"] = {
			mod("LightningMax", "BASE", nil, 0, KeywordFlag.Spell, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["attack_minimum_added_lightning_damage"] = {
			mod("LightningMin", "BASE", nil, 0, KeywordFlag.Attack, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["attack_maximum_added_lightning_damage"] = {
			mod("LightningMax", "BASE", nil, 0, KeywordFlag.Attack, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("radius", 32)
#mods

#skill IceNova
#flags spell area
#baseMod skill("radius", 30)
#mods

#skill VaalIceNova
#flags spell area
#mods

#skill IceSpear
#flags spell projectile
	parts = {
		{
			name = "First Form, 1 Projectile",
		},
		{
			name = "Second Form, 1 Projectile",
		},
		{
			name = "First Form, All Projectiles",
		},
		{
			name = "Second Form, All Projectiles",
		},
	},
	statMap = {
		["ice_spear_second_form_critical_strike_chance_+%"] = {
			mod("CritChance", "INC", nil, 0, 0, { type = "SkillPart", skillPartList = { 2, 4 } }),
		},
		["ice_spear_second_form_critical_strike_multiplier_+"] = {
			mod("CritMultiplier", "BASE", nil, 0, 0, { type = "SkillPart", skillPartList = { 2, 4 } }),
		},
	},
	preDamageFunc = function(activeSkill, output)
		if activeSkill.skillPart == 3 or activeSkill.skillPart == 4 then
			activeSkill.skillData.dpsMultiplier = output.ProjectileCount
		end
	end,
#baseMod mod("PierceChance", "BASE", 100, 0, 0, { type = "SkillPart", skillPart = 1 })
#mods

#skill ColdProjectileMine
#flags spell projectile mine
	statMap = {
		["cold_projectile_mine_enemy_critical_strike_chance_+%_against_self"] = {
			mod("SelfCritChance", "INC", nil, 0, 0, { type = "Limit", limit = 500 }, { type = "GlobalEffect", effectType = "AuraDebuff", effectStackVar = "ActiveMineCount" }),
		},
	},
#mods

#skill ExpandingFireCone
#flags spell area
	parts = {
		{
			name = "No stages",
		},
		{
			name = "Half stages",
		},
		{
			name = "Maximum stages",
		},
		{
			name = "Release"
		},
	},
	statMap = {
		["grant_expanding_fire_cone_release_ignite_damage_+%_final"] = {
			mod("Damage", "MORE", nil, 0, KeywordFlag.Ignite, { type = "SkillPart", skillPart = 4 }),
		},
		["expanding_fire_cone_release_hit_damage_+%_final"] = {
			mod("Damage", "MORE", nil, 0, KeywordFlag.Hit, { type = "SkillPart", skillPart = 4 }),
		},
		["flamethrower_damage_+%_per_stage_final"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "Multiplier", var = "IncinerateStage" }),
		},
		["expanding_fire_cone_radius_+_per_stage"] = {
			skill("radiusExtra", nil, { type = "Multiplier", var = "IncinerateStage" }),
		},
		["expanding_fire_cone_final_wave_always_ignite"] = {
			mod("EnemyIgniteChance", "BASE", nil, 0, 0, { type = "SkillPart", skillPart = 4 }),
			value = 100,
		},
	},
#baseMod mod("Multiplier:IncinerateStage", "BASE", 4, 0, 0, { type = "SkillPart", skillPart = 2 })
#baseMod mod("Multiplier:IncinerateStage", "BASE", 8, 0, 0, { type = "SkillPart", skillPart = 3 })
#baseMod skill("showAverage", true, { type = "SkillPart", skillPart = 4 })
#mods

#skill ClusterBurst
#flags attack projectile area
	parts = {
		{
			name = "Projectile",
			area = false,
		},
		{
			name = "Explosions",
			area = true,
		},
	},
#baseMod skill("radius", 14)
#mods

#skill LightningTowerTrap
#flags spell trap duration area
#mods

#skill LightningTendrilsChannelled
#flags spell area
#baseMod skill("radius", 22)
#mods

#skill LightningTrap
#flags spell trap projectile
#mods

#skill VaalLightningTrap
#flags spell trap projectile duration
#mods

#skill LightningWarp
#flags spell area duration
#baseMod skill("radius", 16)
#mods

#skill VaalLightningWarpInstant
#flags spell area duration
#mods

#skill MagmaOrb
#flags spell projectile area chaining
#mods

#skill DamageOverTimeAura
#flags spell aura area
	statMap = {
		["delirium_aura_damage_over_time_+%_final"] = {
			mod("Damage", "MORE", nil, ModFlag.Dot, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["delirium_skill_effect_duration_+%"] = {
			mod("Duration", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#baseMod skill("radius", 40)
#mods

#skill OrbOfStorms
#flags spell chaining duration
#mods

#skill PowerSiphon
#flags attack projectile
#mods

#skill VaalPowerSiphon
#flags attack projectile
#mods

#skill Sanctify
#flags spell area duration
	parts = {
		{
			name = "Initial hit",
		},
		{
			name = "Shockwave",
		},
	},
	statMap = {
		["sanctify_wave_damage_+%_final"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "SkillPart", skillPart = 2 }),
		},
	},
#baseMod skill("radius", 18)
#baseMod skill("radiusSecondary", 50)
#mods

#skill Purity
#flags spell aura area
	statMap = {
		["base_maximum_fire_damage_resistance_%"] = {
			mod("FireResistMax", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["base_maximum_cold_damage_resistance_%"] = {
			mod("ColdResistMax", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["base_maximum_lightning_damage_resistance_%"] = {
			mod("LightningResistMax", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["base_resist_all_elements_%"] = {
			mod("ElementalResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#baseMod skill("radius", 40)
#mods

#skill LightningResistAura
#flags spell aura area
	statMap = {
		["base_lightning_damage_resistance_%"] = {
			mod("LightningResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["base_maximum_lightning_damage_resistance_%"] = {
			mod("LightningResistMax", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#baseMod skill("radius", 40)
#mods

#skill LightningImpurity
#flags spell aura area duration
	statMap = {
		["hits_ignore_my_lightning_resistance"] = {
			flag("SelfIgnoreLightningResistance", { type = "GlobalEffect", effectType = "Debuff" })
		},
		["impurity_lightning_damage_taken_+%_final"] = {
			mod("LightningDamageTaken", "MORE", nil, 0, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#mods

#skill MortarBarrageMine
#flags spell area projectile mine
	statMap = {
		["mortar_barrage_mine_minimum_added_fire_damage_taken"] = {
			mod("SelfFireMin", "BASE", nil, 0, 0, { type = "Limit", limitVar = "PyroclastSelfFireMinLimit" }, { type = "GlobalEffect", effectType = "AuraDebuff", effectStackVar = "ActiveMineCount" }),
		},
		["mortar_barrage_mine_maximum_added_fire_damage_taken"] = {
			mod("SelfFireMax", "BASE", nil, 0, 0, { type = "Limit", limitVar = "PyroclastSelfFireMaxLimit" }, { type = "GlobalEffect", effectType = "AuraDebuff", effectStackVar = "ActiveMineCount" }),
		},
		["mortar_barrage_mine_minimum_added_fire_damage_taken_limit"] = {
			mod("Multiplier:PyroclastSelfFireMinLimit", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "AuraDebuff", effectName = "Pyroclast Mine Limit" }),
		},
		["mortar_barrage_mine_maximum_added_fire_damage_taken_limit"] = {
			mod("Multiplier:PyroclastSelfFireMaxLimit", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "AuraDebuff", effectName = "Pyroclast Mine Limit" }),
		},
	},
#baseMod skill("radius", 20)
#baseMod skill("radiusLabel", "Area of initial explosion:")
#baseMod skill("radiusSecondary", 26)
#baseMod skill("radiusSecondaryLabel", "Area in which projectiles will land:")
#baseMod skill("radiusTertiary", 12)
#baseMod skill("radiusTertiaryLabel", "Area of projectile explosions:")
#mods

#skill RaiseSpectre
#flags spell minion spectre duration
	minionList = {
	},
	statMap = {
		["accuracy_rating"] = {
			mod("MinionModifier", "LIST", { mod = mod("Accuracy", "BASE", nil) })
		},
		["raised_spectre_level"] = {
			skill("minionLevel", nil),
		},
	},
#mods

#skill RaiseZombie
#flags spell minion
	minionList = {
		"RaisedZombie",
	},
	statMap = {
		["zombie_slam_cooldown_speed_+%"] = {
			mod("MinionModifier", "LIST", { mod = mod("CooldownRecovery", "INC", nil, 0, 0, { type = "SkillId", skillId = "ZombieSlam" }) }),
		},
	},
#mods

#skill RighteousFire
#flags spell area
	preDamageFunc = function(activeSkill, output)
		if activeSkill.skillFlags.totem then
			activeSkill.skillData.FireDot = activeSkill.skillData.FireDot + output.TotemLife * 0.2
		else
			activeSkill.skillData.FireDot = activeSkill.skillData.FireDot + (output.Life + output.EnergyShield) * 0.2
		end
	end,
	statMap = {
		["righteous_fire_spell_damage_+%_final"] = {
			mod("Damage", "MORE", nil, ModFlag.Spell, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["base_nonlethal_fire_damage_%_of_maximum_life_taken_per_minute"] = {
			mod("FireDegen", "BASE", nil, 0, 0, { type = "PerStat", stat = "Life", div = 1}, { type = "GlobalEffect", effectType = "Buff" }),
			div = 6000,
		},
		["base_nonlethal_fire_damage_%_of_maximum_energy_shield_taken_per_minute"] = {
			mod("FireDegen", "BASE", nil, 0, 0, { type = "PerStat", stat = "EnergyShield", div = 1}, { type = "GlobalEffect", effectType = "Buff" }),
			div = 6000,
		},
		["spell_damage_+%"] = {
			mod("Damage", "INC", nil, ModFlag.Spell, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("dotIsArea", true)
#baseMod skill("radius", 18)
#mods

#skill VaalRighteousFire
#flags spell area
	statMap = {
		["vaal_righteous_fire_spell_damage_+%_final"] = {
			mod("Damage", "MORE", nil, ModFlag.Spell, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["vaal_righteous_fire_life_and_es_%_as_damage_per_second"] = {
			skill("FireDot", nil, { type = "PerStat", statList = { "Life", "EnergyShield" } }),
			div = 100,
		},
	},
#baseMod skill("dotIsArea", true)
#mods

#skill FireBeam
#flags spell duration
	parts = {
		{
			name = "1 Stage",
		},
		{
			name = "4 Stages",
		},
		{
			name = "8 Stages",
		},
	},
	statMap = {
		["base_fire_damage_resistance_%"] = {
			mod("FireResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff", effectName = "Fire Exposure", effectCond = "ScorchingRayMaxStages" }),
		},
	},
#baseMod flag("Condition:ScorchingRayMaxStages", { type = "SkillPart", skillPart = 3 })
#baseMod mod("Damage", "MORE", 180, 0, 0, { type = "SkillPart", skillPart = 2 })
#baseMod mod("Damage", "MORE", 420, 0, 0, { type = "SkillPart", skillPart = 3 })
#mods

#skill ShockNova
#flags spell area
	parts = {
		{
			name = "Ring",
		},
		{
			name = "Nova",
		},
	},
	statMap = {
		["newshocknova_first_ring_damage_+%_final"] = {
			mod("Damage", "MORE", nil, 0, 0, { type = "SkillPart", skillPart = 1 }),
		},
	},
#baseMod skill("radius", 26)
#mods

#skill IceSiphonTrap
#flags spell trap duration
	statMap = {
		["skill_life_regeneration_per_minute_per_affected_enemy"] = {
			mod("LifeRegen", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", effectCond = "SiphoningTrapSiphoning" }, { type = "Multiplier", var = "EnemyAffectedBySiphoningTrap", limit = 10 }),
			div = 60,
		},
		["skill_mana_regeneration_per_minute_per_affected_enemy"] = {
			mod("ManaRegen", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", effectCond = "SiphoningTrapSiphoning" }, { type = "Multiplier", var = "EnemyAffectedBySiphoningTrap", limit = 10 }),
			div = 60,
		},
		["skill_life_regeneration_per_minute_with_at_least_1_affected_enemy"] = {
			mod("LifeRegen", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", effectCond = "SiphoningTrapSiphoning" }, { type = "MultiplierThreshold", threshold = 1, var = "EnemyAffectedBySiphoningTrap" }),
			div = 60,
		},
		["skill_mana_regeneration_per_minute_with_at_least_1_affected_enemy"] = {
			mod("ManaRegen", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", effectCond = "SiphoningTrapSiphoning" }, { type = "MultiplierThreshold", threshold = 1, var = "EnemyAffectedBySiphoningTrap" }),
			div = 60,
		},
	},
#mods

#skill Soulrend
#flags spell projectile duration
#baseMod skill("debuff", true)
#baseMod skill("radius", 13)
#mods

#skill Spark
#flags spell projectile duration
#mods

#skill VaalSparkSpiralNova
#flags spell projectile duration
#mods

#skill SpiritOffering
#flags spell duration
	statMap = {
		["physical_damage_%_to_add_as_chaos"] = {
			mod("PhysicalDamageGainAsChaos", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["base_resist_all_elements_%"] = {
			mod("ElementalResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("buffMinions", true)
#baseMod skill("buffNotPlayer", true)
#mods

#skill ConduitSigil
#flags spell area duration
	preDamageFunc = function(activeSkill, output)
		activeSkill.skillData.hitTimeOverride = activeSkill.skillData.repeatFrequency / (1 + activeSkill.skillModList:Sum("INC", activeSkill.skillCfg, "Speed", "BrandActivationFrequency") / 100)
	end,
	statMap = {
		["base_skill_show_average_damage_instead_of_dps"] = {
		},
		["base_sigil_repeat_frequency_ms"] = {
			skill("repeatFrequency", nil),
			div = 1000,
		},
	},
#mods

#skill LightningExplosionMine
#flags spell area mine
	statMap = {
		["lightning_explosion_mine_aura_damage_taken_+%"] = {
			mod("DamageTaken", "INC", nil, 0, 0, { type = "Limit", limit = 150 }, { type = "GlobalEffect", effectType = "AuraDebuff", effectStackVar = "ActiveMineCount" }),
		},
	},
#baseMod skill("radius", 20)
#mods

#skill StormBurstNew
#flags spell area duration
#baseMod skill("radius", 16)
#baseMod skill("radiusSecondary", 22)
#mods

#skill StormCall
#flags spell area duration
	statMap = {
		["base_skill_show_average_damage_instead_of_dps"] = {
		},
	},
#baseMod skill("radius", 20)
#mods

#skill VaalStormCall
#flags spell area duration
#mods

#skill SummonBoneGolem
#flags spell minion golem
	minionList = {
		"SummonedCarrionGolem",
	},
	statMap = {
		["bone_golem_grants_minion_minimum_added_physical_damage"] = {
			mod("MinionModifier", "LIST", { mod = mod("PhysicalMin", "BASE", nil) }, 0, 0, { type = "SkillType", skillType = SkillType.Golem, neg = true }, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["bone_golem_grants_minion_maximum_added_physical_damage"] = {
			mod("MinionModifier", "LIST", { mod = mod("PhysicalMax", "BASE", nil) }, 0, 0, { type = "SkillType", skillType = SkillType.Golem, neg = true }, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("allowTotemBuff", true)
#baseMod flag("Condition:HaveCarrionGolem", { type = "GlobalEffect", effectType = "Buff" })
#mods

#skill SummonChaosGolem
#flags spell minion golem chaos
	minionList = {
		"SummonedChaosGolem",
	},
	statMap = {
		["chaos_golem_grants_additional_physical_damage_reduction_%"] = {
			mod("PhysicalDamageReduction", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("allowTotemBuff", true)
#baseMod flag("Condition:HaveChaosGolem", { type = "GlobalEffect", effectType = "Buff" })
#mods

#skill SummonRelic
#flags spell minion
	minionList = {
		"HolyLivingRelic",
	},
	statMap = {
		["base_number_of_relics_allowed"] = {
			mod("ActiveHolyRelicLimit", "BASE", nil)
		},
	},
#mods

#skill SummonLightningGolem
#flags spell minion golem
	minionList = {
		"SummonedLightningGolem",
	},
	statMap = {
		["lightning_golem_grants_attack_and_cast_speed_+%"] = {
			mod("Speed", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#baseMod skill("allowTotemBuff", true)
#baseMod flag("Condition:HaveLightningGolem", { type = "GlobalEffect", effectType = "Buff" })
#mods

#skill SummonRagingSpirit
#flags spell minion duration
	minionList = {
		"SummonedRagingSpirit",
	},
#mods

#skill SummonSkeletons
#flags spell minion duration
	minionList = {
		"RaisedSkeleton",
		"RaisedSkeletonCaster",
	},
	statMap = {
		["damage_+%"] = {
			mod("MinionModifier", "LIST", { mod = mod("Damage", "INC", 1) })
		},
	},
#mods

#skill VaalSummonSkeletons
#flags spell minion duration
	minionList = {
		"RaisedSkeleton",
		"RaisedSkeletonCaster",
		"RaisedSkeletonArcher",
	},
	statMap = {
		["damage_+%"] = {
			mod("MinionModifier", "LIST", { mod = mod("Damage", "INC", 1) })
		},
	},
#mods

#skill Skitterbots
#flags spell
	statMap = {
		["skitterbots_trap_mine_damage_+%_final"] = {
			mod("Damage", "MORE", nil, 0, bit.bor(KeywordFlag.Mine, KeywordFlag.Trap), { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#mods

#skill TempestShield
#flags spell duration chaining
	statMap = {
		["shield_block_%"] = {
			mod("BlockChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
		["shield_spell_block_%"] = {
			mod("SpellBlockChance", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
		},
	},
#mods

#skill FrostBoltNova
#flags spell area duration forceInstant
#baseMod skill("dotIsArea", true)
#baseMod skill("radius", 20)
#mods

#skill Purge
#flags spell area duration
	statMap = {
		["purge_expose_resist_%_matching_highest_element_damage"] = {
			mod("FireResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff", effectName = "Fire Exposure", effectCond = "WaveOfConvictionFireExposureActive" }),
			mod("ColdResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff", effectName = "Cold Exposure", effectCond = "WaveOfConvictionColdExposureActive" }),
			mod("LightningResist", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff", effectName = "Lightning Exposure", effectCond = "WaveOfConvictionLightningExposureActive" }),
		},
	},
#mods

#skill FrostFury
#flags spell projectile area duration
	parts = {
		{
			name = "Channelling",
		},
		{
			name = "Idle",
		},
	},
	preDamageFunc = function(activeSkill, output)
		local rateMod = (1 + activeSkill.skillModList:Sum("INC", activeSkill.skillCfg, "HitRate", "Speed") / 100)
		local mult = activeSkill.skillModList:More(activeSkill.skillCfg, "HitRate")
		activeSkill.skillData.hitTimeOverride = activeSkill.skillData.repeatFrequency / rateMod / mult
	end,
	statMap = {
		["base_skill_show_average_damage_instead_of_dps"] = {
		},
		["frost_fury_fire_speed_+%_per_stage"] = {
			mod("HitRate", "INC", nil, 0, 0, { type = "Multiplier", var = "WinterOrbStage", limitVar = "WinterOrbMaxStage" }),
		},
		["frost_fury_max_number_of_stages"] = {
			mod("Multiplier:WinterOrbMaxStage", "BASE", nil),
		},
		["frost_fury_base_fire_interval_ms"] = {
			skill("repeatFrequency", nil),
			div = 1000,
		},
		["frost_fury_duration_+%_per_stage"] = {
			mod("Duration", "INC", nil, 0, 0, { type = "Multiplier", var = "WinterOrbStage", limitVar = "WinterOrbMaxStage" }),
		},
		["frost_fury_fire_speed_+%_final_while_channelling"] = {
			mod("HitRate", "MORE", nil, 0, 0, { type = "SkillPart", skillPart = 1 }),
		},
	},
#baseMod skill("radius", 16)
#mods

#skill Wither
#flags spell area duration chaos
	parts = {
		{
			name = "1 Stack",
		},
		{
			name = "5 Stacks",
		},
		{
			name = "10 Stacks",
		},
		{
			name = "15 Stacks",
		},
	},
	statMap = {
		["base_skill_effect_duration"] = {
		},
		["active_skill_withered_base_duration_ms"] = {
			skill("duration", nil),
			div = 1000,
		},
		["chaos_damage_taken_+%"] = {
			mod("ChaosDamageTaken", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff", effectName = "Withered" }),
		},
		["base_movement_velocity_+%"] = {
			mod("MovementSpeed", "INC", nil, 0, 0, { type = "GlobalEffect", effectType = "Debuff", effectName = "Withered" }),
		},
	},
#baseMod skill("debuff", true)
#baseMod skill("radius", 18)
#baseMod skill("stackCount", 1, { type = "SkillPart", skillPart = 1 })
#baseMod skill("stackCount", 5, { type = "SkillPart", skillPart = 2 })
#baseMod skill("stackCount", 10, { type = "SkillPart", skillPart = 3 })
#baseMod skill("stackCount", 15, { type = "SkillPart", skillPart = 4 })
#mods

#skill Wrath
#flags spell aura area
	statMap = {
		["wrath_aura_spell_lightning_damage_+%_final"] = {
			mod("LightningDamage", "MORE", nil, ModFlag.Spell, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["attack_minimum_added_lightning_damage"] = {
			mod("LightningMin", "BASE", nil, 0, KeywordFlag.Attack, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["attack_maximum_added_lightning_damage"] = {
			mod("LightningMax", "BASE", nil, 0, KeywordFlag.Attack, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#baseMod skill("radius", 40)
#mods

#skill SpellDamageAura
#flags spell aura area
	statMap = {
		["spell_damage_aura_spell_damage_+%_final"] = {
			mod("Damage", "MORE", nil, ModFlag.Spell, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
		["spell_critical_strike_chance_+%"] = {
			mod("CritChance", "INC", nil, ModFlag.Spell, 0, { type = "GlobalEffect", effectType = "Aura" }),
		},
	},
#baseMod skill("radius", 40)
#mods